package com.sudo.rpc.server.task;

import com.sudo.rpc.api.utils.RpcRes;
import com.sudo.rpc.server.annotation.Note;
import com.sudo.rpc.server.task.registry.BaseTaskRegistry;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

@Slf4j
public class TestModule extends BaseTaskRegistry {

    public TestModule(){
        setModuleClassMap(getClass());
    }

    /**
     * 测试OK
     * @param paramMap 服务节点
     */
    @Note(desc = "测试OK",params = "serverNode(String,true,192.168.0.12:9998,服务节点)")
    public RpcRes testOK(Map<String,Object> paramMap) {
        log.info("TestModule - testOK - 被调用");
        log.info(paramMap.toString());
        return RpcRes.okMsg("TestModule - testOK - 被调用");
    }

    /**
     * 测试异常
     */
    @Note(desc = "测试异常")
    public RpcRes testException() {
        log.info("TestModule - testException - 被调用");
        throw new RuntimeException("测试异常");
    }
}
